package com.xhd.im;

import java.util.ConcurrentModificationException;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Vector;

public class WaitConnectList
{
  private Hashtable jm547 = null;
  private static WaitConnectList jm16 = null;

  public static WaitConnectList getInstance()
  {
    if (jm16 == null)
      jm16 = new WaitConnectList();
    return jm16;
  }

  public void add(String paramString)
  {
    if (paramString == null)
      return;
    String str = String.valueOf(System.currentTimeMillis());
    this.jm547.put(paramString, str);
  }

  public void remove(String paramString)
  {
    if (paramString == null)
      return;
    this.jm547.remove(paramString);
  }

  public Vector getTimeoutAndRemove(long paramLong)
  {
    if (paramLong < 1L)
      return null;
    paramLong *= 60000L;
    if (this.jm547.size() < 1)
      return null;
    Iterator localIterator = this.jm547.keySet().iterator();
    if (localIterator == null)
      return null;
    Vector localVector = new Vector();
    int i = 0;
    while (i < 5)
    {
      long l1 = System.currentTimeMillis();
      try
      {
        while (localIterator.hasNext())
        {
          String str1 = (String)localIterator.next();
          String str2 = (String)this.jm547.get(str1);
          if (str2 == null)
            continue;
          long l2 = Long.parseLong(str2);
          if (l1 - l2 <= paramLong)
            continue;
          localVector.add(str1);
        }
      }
      catch (ConcurrentModificationException localConcurrentModificationException)
      {
        ++i;
      }
    }
    i = localVector.size();
    for (int j = 0; j < i; ++j)
      this.jm547.remove(localVector.get(j));
    return localVector;
  }
}